package com.allwees.bs.c.module.product.controller;

import com.allwees.bs.c.module.base.controller.BaseController;
import com.allwees.bs.c.module.product.service.CategoryService;
import com.allwees.bs.core.modelbase.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类目相关
 */
@Validated
@RestController
@RequestMapping("/api/category")
public class CategoryController extends BaseController {

    @Autowired
    private CategoryService categoryService;

    /**
     * 获取所有类目
     * @return
     */
    @GetMapping
    public R getCategories() {
        return R.ok(categoryService.getAllCategories());
    }
}
